#include "Irp.h"

NTSTATUS IrpGeneral(IN struct _DEVICE_OBJECT* DeviceObject, IN OUT struct _IRP* Irp)
{
    UNREFERENCED_PARAMETER(DeviceObject);
    UNREFERENCED_PARAMETER(Irp);
    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);
    return STATUS_SUCCESS;
}

NTSTATUS IrpDeviceControl(IN struct _DEVICE_OBJECT* DeviceObject, IN OUT struct _IRP* Irp)
{
    UNREFERENCED_PARAMETER(DeviceObject);

    PIO_STACK_LOCATION lpIoStackLocation = IoGetCurrentIrpStackLocation(Irp);
    ULONG uIoCtlCode = lpIoStackLocation->Parameters.DeviceIoControl.IoControlCode;
    ULONG uInputLength = lpIoStackLocation->Parameters.DeviceIoControl.InputBufferLength;
    PVOID lpBuff = Irp->AssociatedIrp.SystemBuffer;
    NTSTATUS retStatus = STATUS_SUCCESS;
    NTSTATUS IoStatus = STATUS_SUCCESS;
    ULONG uInformation = 0;

    switch (uIoCtlCode)
    {
    case IOCTL_READ_MODULEBASE:
    {
        DBGPRINT("IOCTL_READ_MODULEBASE\r\n");
        if (uInputLength == sizeof(ULONG))
            DBGPRINT("%d\r\n", *((PULONG)lpBuff));
        break;
    }
    default:
        break;
    }

    Irp->IoStatus.Status = IoStatus;
    Irp->IoStatus.Information = uInformation;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);
    return retStatus;
}
